<!DOCTYPE html>
<html class="loading" lang="en" data-textdirection="ltr">
  <!-- BEGIN: Head-->
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
    <meta name="description" content="Materialize is a Material Design Admin Template,It's modern, responsive and based on Material Design by Google.">
    <meta name="keywords" content="materialize, admin template, dashboard template, flat admin template, responsive admin template, eCommerce dashboard, analytic dashboard">
    <meta name="author" content="ThemeSelect">
    <title>生态圈系统-开票信息管理</title>
    <link rel="icon" th:href="@{/images/favicon.ico}" th:mce_href="@{/images/favicon.ico}" type="image/x-icon">
    <link rel="shortcut icon" th:href="@{/images/favicon.ico}" th:mce_href="@{/images/favicon.ico}" type="image/x-icon">
    <link rel="apple-touch-icon" th:href="@{/images/favicon.ico}" th:mce_href="@{/images/favicon.ico}" type="image/x-icon">
    
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link href="css/bootstrap.min.css" th:href="@{/css/bootstrap.css}" type="text/css" rel="stylesheet"/>
    <!-- BEGIN: VENDOR CSS-->
    <link rel="stylesheet" type="text/css" href="../../../app-assets/vendors/vendors.min.css" th:href="@{/app-assets/vendors/vendors.min.css}">
    <link rel="stylesheet" type="text/css" href="../../../app-assets/vendors/flag-icon/css/flag-icon.min.css" th:href="@{/app-assets/vendors/flag-icon/css/flag-icon.min.css}">
    <link rel="stylesheet" type="text/css" href="../../../app-assets/vendors/data-tables/css/jquery.dataTables.min.css" th:href="@{/app-assets/vendors/data-tables/css/jquery.dataTables.min.css}">
    <link rel="stylesheet" type="text/css" href="../../../app-assets/vendors/data-tables/extensions/responsive/css/responsive.dataTables.min.css" th:href="@{/app-assets/vendors/data-tables/extensions/responsive/css/responsive.dataTables.min.css}">
    <link rel="stylesheet" type="text/css" href="../../../app-assets/vendors/data-tables/css/select.dataTables.min.css" th:href="@{/app-assets/vendors/data-tables/css/select.dataTables.min.css}">
    <!-- END: VENDOR CSS-->
    <!-- BEGIN: Page Level CSS-->
    <link rel="stylesheet" type="text/css" href="../../../app-assets/css/themes/vertical-gradient-menu-template/materialize.css" th:href="@{/app-assets/css/themes/vertical-gradient-menu-template/materialize.css}">
    <link rel="stylesheet" type="text/css" href="../../../app-assets/css/themes/vertical-gradient-menu-template/style.css" th:href="@{/app-assets/css/themes/vertical-gradient-menu-template/style.css}">
    <link rel="stylesheet" type="text/css" href="../../../app-assets/css/pages/data-tables.css" th:href="@{/app-assets/css/pages/data-tables.css}">
    <!-- END: Page Level CSS-->
    <!-- BEGIN: Custom CSS-->
    <link href="plugins/bootstrap-datepicker/css/bootstrap-datepicker.css" th:href="@{/plugins/bootstrap-datepicker/css/bootstrap-datepicker.css}" type="text/css" rel="stylesheet"/>
	  <link href="plugins/bootstrap-sweetalert/sweetalert.css" th:href="@{/plugins/bootstrap-sweetalert/sweetalert.css}" type="text/css" rel="stylesheet"/>
	  <link rel="stylesheet" type="text/css" href="../../../app-assets/css/custom/custom.css" th:href="@{/app-assets/css/custom/custom.css}">
    <!-- END: Custom CSS-->
    
    <style>
	    input[type="text"]:not(.browser-default) {
	      height: 2rem;
	      margin-bottom: -1px;
	    }
	    .input-field > label:not(.label-icon).active {
	      line-height: 0rem;
	    }
	    tr {
        border-bottom: unset;
	    }
	    td {
	      max-width: 100px;
	      padding: 5px 5px;
	    }
	  </style>
  </head>
  <!-- END: Head-->
  <body class="vertical-layout page-header-light vertical-menu-collapsible vertical-gradient-menu 2-columns" data-open="click" data-menu="vertical-gradient-menu" data-col="2-columns">

    <!-- BEGIN: Header-->
    <div th:replace="common/header :: header"></div>
    <!-- END: Header-->

    <div th:replace="common/aside_admin :: aside"></div>

    <!-- BEGIN: Page Main-->
    <div id="main">
      <div class="row">
        <div class="pt-3 pb-1" id="breadcrumbs-wrapper">
          <!-- Search for small screen-->
          <div class="container">
            <div class="row">
              <div class="col s12 m6 l6">
                <h5 class="breadcrumbs-title mt-0 mb-0" id="page-title" active-menu="invoice-menu">开票信息管理</h5>
              </div>
              <div class="col s12 m6 l6 right-align-md hide">
                <ol class="breadcrumbs mb-0">
                  <li class="breadcrumb-item"><a href="index.html">Home</a></li>
                  <li class="breadcrumb-item"><a href="#">Pages</a></li>
                  <li class="breadcrumb-item active">Blank Page</li>
                </ol>
              </div>
            </div>
          </div>
        </div>
        <div class="col s12">
          <div class="container">
            <div class="section section-data-tables">
              <div class="row">
                <div class="col s12 m12 l12">
                  <div id="button-trigger" class="card card card-default scrollspy">
                    <div class="card-content">
                      <div class="row">
                        <div class="col s8 offset-s2">
                          <table>
									          <thead>
									            <tr style="border-bottom: 0;">
									              <th class="no-padding" width="20%"></th>
									              <th class="no-padding" width="80%"></th>
									            </tr>
									          </thead>
									
									          <tbody>
									            <tr>
									              <td class="right">
									                <div class="input-field">发票类型</div>
									              </td>
									              <td>
									                <div class="input-field" style="margin-top: 0; margin-bottom: 0;">
									                  <input type="text" name="type" id="type" class="validate" required th:value="${invoice.type}" maxlength="50">
									                </div>
									              </td>
									            </tr>
									            <tr>
									              <td class="right">
									                <div class="input-field">名称</div>
									              </td>
									              <td>
									                <div class="input-field" style="margin-top: 0px; margin-bottom: 0px;">
									                  <input type="text" name="name" id="name" class="validate" required th:value="${invoice.name}" maxlength="200">
									                </div>
									              </td>
									            </tr>
									            <tr>
									              <td class="right">
									                <div class="input-field">纳税人识别号</div>
									              </td>
									              <td>
									                <div class="input-field" style="margin-top: 0px; margin-bottom: 0px;">
									                  <input type="text" name="taxNo" id="taxNo" class="validate" required th:value="${invoice.taxNo}" maxlength="30">
									                </div>
									              </td>
									            </tr>
									            <tr>
									              <td class="right"><div class="input-field">地址、电话</div></td>
									              <td>
									                <div class="input-field" style="margin-top: 0px; margin-bottom: 0px;">
									                  <input type="text" name="addressAndPhone" id="addressAndPhone" class="validate" required th:value="${invoice.addressAndPhone}" maxlength="200">
									                </div>
									              </td>
									            </tr>
									            <tr>
									              <td class="right">
									                <div class="input-field">开户行及账号</div>
									              </td>
									              <td>
									                <div class="input-field" style="margin-top: 0px; margin-bottom: 0px;">
									                  <input type="text" name="branchAndAccount" id="branchAndAccount" class="validate" required th:value="${invoice.branchAndAccount}" maxlength="200">
									                </div>
									              </td>
									            </tr>
									            <tr>
									              <td class="right">
									                <div class="input-field">开票项目</div>
									              </td>
									              <td>
									                <div class="input-field" style="margin-top: 0px; margin-bottom: 0px;">
									                  <input type="text" name="title" id="title" class="validate" required th:value="${invoice.title}" maxlength="200">
									                </div>
									              </td>
									            </tr>
									            <tr>
									              <td></td>
									              <td>
									                <button class="btn waves-effect waves-light light-blue darken-1 right" type="submit" name="action" style="margin-right: 10px;" onclick="updateSubmit()">保存</button>
									              </td>
									            </tr>
									          </tbody>
									        </table>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- END: Page Main-->

    <!-- BEGIN: Footer-->

    <div th:replace="common/footer :: footer"></div>
    
    <!-- END: Footer-->
    
	  <div th:replace="common/update_pwd :: #modal3"></div>
	
    <!-- BEGIN VENDOR JS-->
    <script src="../../../app-assets/js/vendors.min.js" th:src="@{/app-assets/js/vendors.min.js}" type="text/javascript"></script>
    <!-- BEGIN VENDOR JS-->
    <!-- BEGIN PAGE VENDOR JS-->
    <script src="../../../app-assets/vendors/data-tables/js/jquery.dataTables.min.js" th:src="@{/app-assets/vendors/data-tables/js/jquery.dataTables.min.js}" type="text/javascript"></script>
    <script src="../../../app-assets/vendors/data-tables/extensions/responsive/js/dataTables.responsive.min.js" th:src="@{/app-assets/vendors/data-tables/extensions/responsive/js/dataTables.responsive.min.js}" type="text/javascript"></script>
    <script src="../../../app-assets/vendors/data-tables/js/dataTables.select.min.js" th:src="@{/app-assets/vendors/data-tables/js/dataTables.select.min.js}" type="text/javascript"></script>
    <!-- END PAGE VENDOR JS-->
    <!-- BEGIN THEME  JS-->
    <script src="../../../app-assets/js/plugins.js" th:src="@{/app-assets/js/plugins.js}" type="text/javascript"></script>
    <script src="../../../app-assets/js/custom/custom-script.js" th:src="@{/app-assets/js/custom/custom-script.js}" type="text/javascript"></script>
    <!-- END THEME  JS-->
    <!-- BEGIN PAGE LEVEL JS-->
    <script src="../../../app-assets/js/scripts/data-tables.js" th:src="@{/app-assets/js/scripts/data-tables.js}" type="text/javascript"></script>
    <!-- END PAGE LEVEL JS-->
    <script src="plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js" th:src="@{/plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js}"></script>
	  <script src="plugins/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js" th:src="@{/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js}" charset="UTF-8"></script>
	  <script src="plugins/bootstrap-sweetalert/sweetalert.min.js" th:src="@{/plugins/bootstrap-sweetalert/sweetalert.min.js}"></script>
    <script src="js/common.js" th:src="@{/js/common.js}"></script>
    <script th:inline="javascript">
      function updateSubmit() {
        var input_elems = $('.card-content input');
        input_elems.each(function(){
          M.validate_field($(this));
        });
        var invalid_input_elems = $('.card-content input.invalid');
        console.log(invalid_input_elems.length);
        if(invalid_input_elems.length > 0) {
          swal({
            title: "保存失败!",
            text: "请完善信息!",
            icon: "error",
            //timer: 2000,
          });
          return false;
        }
        $.ajax({
          url: context_path + "/api/v1/invoice-info/",
          data: '{"type" : "' + $('input[name="type"]').val()
              + '", "name" : "' + $('input[name="name"]').val()
              + '", "taxNo" : "' + $('input[name="taxNo"]').val()
              + '", "addressAndPhone" : "' + $('input[name="addressAndPhone"]').val()
              + '", "branchAndAccount" : "' + $('input[name="branchAndAccount"]').val()
              + '", "title" : "' + $('input[name="title"]').val()
              + '", "id" : 1'
              + '}',
          contentType: "application/json;charset=utf-8",
          type: "PUT",
          headers: {
            Accept: "application/json"
          },
          success: function(data, textStatus) {
            console.log(data);
            swal({
              title: "",
              text: "保存成功!",
              icon: "success",
              timer: 2000,
            }).then(function(value) {
              $("input[type=reset]").trigger("click");
              window.location.reload();
            });
          },
          error: function (data, textStatus, errorThrown) {
            //console.log(data);
            swal({
              title: "保存失败!",
              text: data.responseJSON.message,
              icon: "error",
              //timer: 2000,
            });
            M.updateTextFields();
          }
        });
      }
	
	  </script>
  </body>
</html>